<style type="text/css">
	.a{
		color:yellow;
	}
</style>
<?php
session_start();
$_SESSION['namauser'] = $_POST['nama'];
include "../config/connect.php";

// $user = $_POST['username'];
// $pass = $_POST['pass'];
$nama = $_POST['nama'];
$pass = $_POST['pass'];
if(empty($nama) || empty($pass)){
	echo "<h4 class='a'>Tidak Boleh Kosong !</h4>";
}
else{$mysql = mysql_query("SELECT * FROM user where id_user = '$nama' ");
	$data = mysql_fetch_array($mysql);
	
	if($data[0]!=$nama)
	{
		echo "<h4 class='a'>Maaf Username Salah</h4>";
	}
	else if($data[1]!=$pass)
	{
		echo "<h4 class='a'>Maaf Password Salah !</h4>";
	}
	else{
		$a = "Kabag Unit Kerja";
		$b = "Kabag Operator Pusat";
		$c = "Kabag Pengadaan";
		$d = "Operator Gupus";
		switch ("$data[bidang]")
		{
			case $a:
				echo "
				<script type='text/javascript'>
				window.location.href='http://localhost/RPL/admin/kabaguk.php?a=$data[bidang]';
				</script>
				";
				break;
			case $b:
				echo "
				<script type='text/javascript'>
				window.location.href='http://localhost/RPL/admin/kabagop.php?a=$data[bidang]';
				</script>
				";
			break;
			case $c:
				echo "
				<script type='text/javascript'>
				window.location.href='http://localhost/RPL/admin/kabagpengadaan.php?a=$data[bidang]';
				</script>
				";
			break;
			case $d:
				echo "
				<script type='text/javascript'>
				window.location.href='http://localhost/RPL/admin/operatorgupus.php?a=$data[bidang]';
				</script>
				";
			break;
		}
		
}
	
}
	
?>